package leetcode.code1379;

import leetcode.IDebug;
import leetcode.helper.tree.TreeNode;

public class Solution implements IDebug {

	public final TreeNode getTargetCopy(final TreeNode original, final TreeNode cloned, final TreeNode target) {
		if (original.val == target.val) {
			return cloned;
		}
		TreeNode ans = null;
		if (original.left != null) {
			ans = this.getTargetCopy(original.left, cloned.left, target);
		}
		if (ans == null && original.right != null) {
			return this.getTargetCopy(original.right, cloned.right, target);
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
